package com.vertx.zipkin;

import com.vertx.util.Runner;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Promise;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.client.WebClient;
import io.vertx.ext.web.handler.BodyHandler;
import io.vertx.tracing.zipkin.ZipkinTracingOptions;

public class WorldVerticle extends AbstractVerticle {
	public static void main(String[] args) {

		Runner.runExample(WorldVerticle.class);

	}


	public void WorldVerticle(){

	}

	@Override
	public void start(Promise<Void> startPromise) throws Exception {

		HttpServer server = vertx.createHttpServer();


		Router router = Router.router(vertx);

		router.route().handler(BodyHandler.create());

		router.route("/world").handler(req -> {

			System.out.println("=======》/world");

			try {
				Thread.sleep(3000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}

			req.response()
					.putHeader("content-type", "application/plain")
					.end("world!!!!!!");
		});
		server.requestHandler(router).listen(8082);
	}
}